package co.com.inventarios.modelo;

import java.sql.Timestamp;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Mngmcn entity.
 * 
 * @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "MNGMCN", schema = "MANAGER", uniqueConstraints = {})
public class Mngmcn implements java.io.Serializable {

	// Fields

	private MngmcnId id;
	private Label label;
	private Unimed unimedByMcnuniO;
	private Bodega bodega;
	private Mngdoc mngdoc;
	private Cataventa cataventa;
	private Tipoiva tipoiva;
	private Unimed unimedByMcnunimed;
	private Producto producto;
	private String mcncuenta;
	private String mcnindinv;
	private Double mcncantiO;
	private Double mcnfactor;
	private Double mcncantid;
	private Double mcnpreciob;
	private Double mcnparciO;
	private Double mcnivaporc;
	private Long mcnivainc;
	private Double mcncostott;
	private String mcnref_emp;
	private String mcnref_cla;
	private String mcnref_tip;
	private Double mcnref_num;
	private Double mcnref_reg;
	private Timestamp mcnlogfec;
	private Dlluser dlluser;
	private Set<Mngmcnsn> mngmcnsns = new HashSet<Mngmcnsn>(0);

	// Constructors

	/** default constructor */
	public Mngmcn() {
	}

	/** minimal constructor */
	public Mngmcn(MngmcnId id, Unimed unimedByMcnuniO, Bodega bodega,
			Mngdoc mngdoc, Cataventa cataventa, Tipoiva tipoiva,Dlluser dlluser,
			Timestamp mcnlogfec,Unimed unimedByMcnunimed, Producto producto) {
		this.id = id;
		this.unimedByMcnuniO = unimedByMcnuniO;
		this.bodega = bodega;
		this.mngdoc = mngdoc;
		this.mcnlogfec = mcnlogfec;
		this.dlluser = dlluser;
		this.cataventa = cataventa;
		this.tipoiva = tipoiva;
		this.unimedByMcnunimed = unimedByMcnunimed;
		this.producto = producto;
	}

	/** full constructor */
	public Mngmcn(MngmcnId id, Label label, Unimed unimedByMcnuniO,
			Bodega bodega, Mngdoc mngdoc, Cataventa cataventa, Tipoiva tipoiva,
			Unimed unimedByMcnunimed, Producto producto, String mcncuenta,
			String mcnindinv, Double mcncantiO, Double mcnfactor,
			Double mcncantid, Double mcnpreciob, Double mcnparciO,
			Double mcnivaporc, Long mcnivainc, Double mcncostott,String mcnref_emp,
			 String mcnref_cla,String mcnref_tip,Double mcnref_num,Double mcnref_reg,
			Set<Mngmcnsn> mngmcnsns) {
			
		
		this.id = id;
		this.label = label;
		this.unimedByMcnuniO = unimedByMcnuniO;
		this.bodega = bodega;
		this.mngdoc = mngdoc;
		this.cataventa = cataventa;
		this.tipoiva = tipoiva;
		this.unimedByMcnunimed = unimedByMcnunimed;
		this.producto = producto;
		this.mcncuenta = mcncuenta;
		this.mcnindinv = mcnindinv;
		this.mcncantiO = mcncantiO;
		this.mcnfactor = mcnfactor;
		this.mcncantid = mcncantid;
		this.mcnpreciob = mcnpreciob;
		this.mcnparciO = mcnparciO;
		this.mcnivaporc = mcnivaporc;
		this.mcnivainc = mcnivainc;
		this.mcncostott = mcncostott;
		this.mngmcnsns = mngmcnsns;
		this.mcnref_emp = mcnref_emp;
		this.mcnref_cla = mcnref_cla;
		this.mcnref_tip = mcnref_tip;
		this.mcnref_num = mcnref_num;
		this.mcnref_reg = mcnref_reg;
	}

	// Property accessors
	@EmbeddedId
	@AttributeOverrides( {
			@AttributeOverride(name = "mcnempresa", column = @Column(name = "MCNEMPRESA", unique = false, nullable = false, insertable = true, updatable = true, length = 3)),
			@AttributeOverride(name = "mcnclase", column = @Column(name = "MCNCLASE", unique = false, nullable = false, insertable = true, updatable = true, length = 4)),
			@AttributeOverride(name = "mcnvinkey", column = @Column(name = "MCNVINKEY", unique = false, nullable = false, insertable = true, updatable = true, length = 15)),
			@AttributeOverride(name = "mcntipodoc", column = @Column(name = "MCNTIPODOC", unique = false, nullable = false, insertable = true, updatable = true, length = 4)),
			@AttributeOverride(name = "mcnnumedoc", column = @Column(name = "MCNNUMEDOC", unique = false, nullable = false, insertable = true, updatable = true, precision = 13, scale = 1)),
			@AttributeOverride(name = "mcnreg", column = @Column(name = "MCNREG", unique = false, nullable = false, insertable = true, updatable = true, precision = 8, scale = 1)) })
	public MngmcnId getId() {
		return this.id;
	}

	public void setId(MngmcnId id) {
		this.id = id;
	}

	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumn(name = "MCNESTADO", unique = false, nullable = true, insertable = true, updatable = true)
	public Label getLabel() {
		return this.label;
	}

	public void setLabel(Label label) {
		this.label = label;
	}

	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumn(name = "MCNUNI_O", unique = false, nullable = false, insertable = true, updatable = true)
	public Unimed getUnimedByMcnuniO() {
		return this.unimedByMcnuniO;
	}

	public void setUnimedByMcnuniO(Unimed unimedByMcnuniO) {
		this.unimedByMcnuniO = unimedByMcnuniO;
	}

	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumn(name = "MCNLOGUSER", unique = false, nullable = true, insertable = true, updatable = true)
	public Dlluser getDlluser() {
		return this.dlluser;
	}

	public void setDlluser(Dlluser dlluser) {
		this.dlluser = dlluser;
	}

	@Column(name = "MCNLOGFEC", unique = false, nullable = true, insertable = true, updatable = true)
	public Timestamp getMcnlogfec() {
		return this.mcnlogfec;
	}

	public void setMcnlogfec(Timestamp mcnlogfec) {
		this.mcnlogfec = mcnlogfec;
	}
	
	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumn(name = "MCNBODEGA", unique = false, nullable = false, insertable = true, updatable = true)
	public Bodega getBodega() {
		return this.bodega;
	}

	public void setBodega(Bodega bodega) {
		this.bodega = bodega;
	}


	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumns( {
			@JoinColumn(name = "MCNEMPRESA", referencedColumnName = "DOCEMPRESA" , unique = false, nullable = false, insertable = false, updatable = false),
			@JoinColumn(name = "MCNCLASE", referencedColumnName = "DOCCLASE" , unique = false, nullable = false, insertable = false, updatable = false),
			@JoinColumn(name = "MCNVINKEY", referencedColumnName = "DOCVINKEY" , unique = false, nullable = false, insertable = false, updatable = false),
			@JoinColumn(name = "MCNTIPODOC", referencedColumnName = "DOCTIPO" , unique = false, nullable = false, insertable = false, updatable = false),
			@JoinColumn(name = "MCNNUMEDOC", referencedColumnName = "DOCNUMERO" , unique = false, nullable = false, insertable = false, updatable = false) })
	public Mngdoc getMngdoc() {
		return this.mngdoc;
	}
	
	
	public void setMngdoc(Mngdoc mngdoc) {
		this.mngdoc = mngdoc;
	}

	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumn(name = "MCNCATALOG", unique = false, nullable = false, insertable = true, updatable = true)
	public Cataventa getCataventa() {
		return this.cataventa;
	}

	public void setCataventa(Cataventa cataventa) {
		this.cataventa = cataventa;
	}

	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumn(name = "MCNIVATIPO", unique = false, nullable = false, insertable = true, updatable = true)
	public Tipoiva getTipoiva() {
		return this.tipoiva;
	}

	public void setTipoiva(Tipoiva tipoiva) {
		this.tipoiva = tipoiva;
	}

	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumn(name = "MCNUNIMED", unique = false, nullable = false, insertable = true, updatable = true)
	public Unimed getUnimedByMcnunimed() {
		return this.unimedByMcnunimed;
	}

	public void setUnimedByMcnunimed(Unimed unimedByMcnunimed) {
		this.unimedByMcnunimed = unimedByMcnunimed;
	}

	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumn(name = "MCNPRODUCT", unique = false, nullable = false, insertable = true, updatable = true)
	public Producto getProducto() {
		return this.producto;
	}

	public void setProducto(Producto producto) {
		this.producto = producto;
	}

	@Column(name = "MCNCUENTA", unique = false, nullable = true, insertable = true, updatable = true, length = 20)
	public String getMcncuenta() {
		return this.mcncuenta;
	}

	public void setMcncuenta(String mcncuenta) {
		this.mcncuenta = mcncuenta;
	}

	@Column(name = "MCNINDINV", unique = false, nullable = true, insertable = true, updatable = true, length = 1)
	public String getMcnindinv() {
		return this.mcnindinv;
	}

	public void setMcnindinv(String mcnindinv) {
		this.mcnindinv = mcnindinv;
	}

	@Column(name = "MCNCANTI_O", unique = false, nullable = true, insertable = true, updatable = true, precision = 15, scale = 4)
	public Double getMcncantiO() {
		return this.mcncantiO;
	}

	public void setMcncantiO(Double mcncantiO) {
		this.mcncantiO = mcncantiO;
	}

	@Column(name = "MCNFACTOR", unique = false, nullable = true, insertable = true, updatable = true, precision = 7, scale = 3)
	public Double getMcnfactor() {
		return this.mcnfactor;
	}

	public void setMcnfactor(Double mcnfactor) {
		this.mcnfactor = mcnfactor;
	}

	@Column(name = "MCNCANTID", unique = false, nullable = true, insertable = true, updatable = true, precision = 15, scale = 4)
	public Double getMcncantid() {
		return this.mcncantid;
	}

	public void setMcncantid(Double mcncantid) {
		this.mcncantid = mcncantid;
	}

	@Column(name = "MCNPRECIOB", unique = false, nullable = true, insertable = true, updatable = true, precision = 12)
	public Double getMcnpreciob() {
		return this.mcnpreciob;
	}

	public void setMcnpreciob(Double mcnpreciob) {
		this.mcnpreciob = mcnpreciob;
	}

	@Column(name = "MCNREF_EMP", unique = false, nullable = true, insertable = true, updatable = true, length = 3)
	public String getMcnref_emp() {
		return this.mcnref_emp;
	}

	public void setMcnref_emp(String mcnref_emp) {
		this.mcnref_emp = mcnref_emp;
	}
	
	@Column(name = "MCNREF_CLA", unique = false, nullable = true, insertable = true, updatable = true, length = 4)
	public String getMcnref_cla() {
		return this.mcnref_cla;
	}

	public void setMcnref_cla(String mcnref_cla) {
		this.mcnref_cla = mcnref_cla;
	}
	
	@Column(name = "MCNREF_TIP", unique = false, nullable = true, insertable = true, updatable = true, length = 4)
	public String getMcnref_tip() {
		return this.mcnref_tip;
	}

	public void setMcnref_tip(String mcnref_tip) {
		this.mcnref_tip= mcnref_tip;
	}
	
	@Column(name = "MCNREF_NUM", unique = false, nullable = true, insertable = true, updatable = true, precision = 13, scale = 1)
	public Double getMcnref_num() {
		return this.mcnref_num;
	}

	public void setMcnref_num(Double mcnref_num) {
		this.mcnref_num = mcnref_num;
	}	
	
	@Column(name = "MCNREF_REG", unique = false, nullable = true, insertable = true, updatable = true, precision = 7, scale = 1)
	public Double getMcnref_reg() {
		return this.mcnref_reg;
	}

	public void setMcnref_reg(Double mcnref_reg) {
		this.mcnref_reg = mcnref_reg;
	}	
	
	@Column(name = "MCNPARCI_O", unique = false, nullable = true, insertable = true, updatable = true, precision = 12)
	public Double getMcnparciO() {
		return this.mcnparciO;
	}

	public void setMcnparciO(Double mcnparciO) {
		this.mcnparciO = mcnparciO;
	}

	@Column(name = "MCNIVAPORC", unique = false, nullable = true, insertable = true, updatable = true, precision = 7, scale = 3)
	public Double getMcnivaporc() {
		return this.mcnivaporc;
	}

	public void setMcnivaporc(Double mcnivaporc) {
		this.mcnivaporc = mcnivaporc;
	}

	@Column(name = "MCNIVAINC", unique = false, nullable = true, insertable = true, updatable = true, precision = 22, scale = 0)
	public Long getMcnivainc() {
		return this.mcnivainc;
	}

	public void setMcnivainc(Long mcnivainc) {
		this.mcnivainc = mcnivainc;
	}

	@Column(name = "MCNCOSTOTT", unique = false, nullable = true, insertable = true, updatable = true, precision = 12)
	public Double getMcncostott() {
		return this.mcncostott;
	}

	public void setMcncostott(Double mcncostott) {
		this.mcncostott = mcncostott;
	}

	@OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY, mappedBy = "mngmcn")
	public Set<Mngmcnsn> getMngmcnsns() {
		return this.mngmcnsns;
	}

	public void setMngmcnsns(Set<Mngmcnsn> mngmcnsns) {
		this.mngmcnsns = mngmcnsns;
	}

}